<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="app">     
        <input type="text" @input="handleInput">
        <ul>
            <li v-for="item,index in list">{{ item }}</li>
        </ul>
    </div>
    <script>
        let app = new Vue({
            el: "#app",
            data: {
                list:["aaa","bbb","abc","bac","bbc","cbb","ccc"],
                //备份原始数据
                copyList:["aaa","bbb","abc","bac","bbc","cbb","ccc"]
            },
            methods: {
                handleInput(event){
                    // this.list = this.copyList.filter( item => item.indexOf(event.target.value) == 0 ); 检测 val 在第一个
                    this.list = this.copyList.filter( item => item.includes(event.target.value) );//检测 val 存在
                    
                }

            }
        })
        // 改变原数组的方法：push pop splice shift unshift sort reverse
        // 不改变原数组的方法: filter map slice concat (vue 不会重新渲染)
    </script>
</body>
</html>